<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const fn = test.bind(this, arg)
    fn()
    Function.prototype._bind = function () {
      if(typeof this != 'function') return
      let fn = this
      const args = Array.prototype.slice.call(arguments)
      const newThis = args.shift()
      return function () {
        return fn.apply(newThis, args)
      }
    }
    function foo(b) {
      console.log(b);
      console.log(this.a);
    }
    let obj = {
      a: 23
    }
    let ab = foo._bind(obj,3,4)
    console.log(ab);
    // let ac = foo.bind(obj,1)
    // ac(2)
    ab(5,2,3)
  </script>
</body>
</html>